package org.pojo;

public enum FileSuffixEnum {

    TXT(".txt", "txt"),
    EXCEL(".xls", "excel"),
    WORD(".doc", "word"),
    ZIP(".zip", "zip");

    private String fileSuffix;

    private String fileTypeName;


    /**
     * 根据传入文件类型获取文件后缀名
     *
     * @param fileType 文件类型
     * @return
     */
    public static String getSuffixByFileType(String fileType) {
        for (FileSuffixEnum typeEnum : FileSuffixEnum.values()) {
            if (fileType.equals(typeEnum.getFileTypeName())) {
                return typeEnum.getFileSuffix();
            }
        }
        return "";
    }

    FileSuffixEnum(String fileSuffix, String fileTypeName) {
        this.fileSuffix = fileSuffix;
        this.fileTypeName = fileTypeName;
    }

    public String getFileSuffix() {
        return fileSuffix;
    }

    public void setFileSuffix(String fileSuffix) {
        this.fileSuffix = fileSuffix;
    }

    public String getFileTypeName() {
        return fileTypeName;
    }

    public void setFileTypeName(String fileTypeName) {
        this.fileTypeName = fileTypeName;
    }
}
